/*
 * @Description:
 * @Author: qingyang
 * @Date: 2023-06-05 17:05:31
 * @LastEditors: qingyang
 * @LastEditTime: 2023-06-06 11:47:17
 */
import { get } from '@/utils/http';
import {
  GetTaskDataSummaryListResult,
  GetUserAccountResult,
  systemNotifyListParams,
  SystemNotifyListResult,
  SystemNotifyDetailResult,
  GetTodoStatisticsResult,
  IFootprintIndicator,
  IInventoryIndicator,
  IContactInfo
} from './model/workbenchModel';
import { BasicPagingListResult } from '@/apis/basicModel';

enum Api {
  // 碳足迹工作台接口
  GET_STATISTICS = '/footprint/workbench/getStatistics',
  // 任务汇总
  TASK_SUMMARY = '/inventory/workbench/taskSummary',
  // 获取客户账户
  GET_USER_ACCOUNT = '/upms/customer/getAccount',
  // 待办统计信息
  GET_TODO_STATISTICS = '/workflow/task/toDoList',
  // 碳盘查指标数据统计
  GET_INVENTORY_INDICATOR = '/inventory/indicator/countData',
  // 碳足迹指标数据统计
  GET_FOOTPRINT_INDICATOR = '/footprint/indicator/countData',
  // 获取系统联系人信息
  GET_CONTACT_INFO = '/upms/systemDict/getContactInfo'
}

// 碳足迹工作台接口
export const getStatistics = (): Promise<any> => get(Api.GET_STATISTICS);

// 碳盘查任务汇总
export const taskSummary = (): Promise<GetTaskDataSummaryListResult> => get(Api.TASK_SUMMARY);
// 获取客户账户
export const getUserAccount = (): Promise<GetUserAccountResult> => get(Api.GET_USER_ACCOUNT);
// 系统公告、帮助中心文件列表
export const systemNotifyList = (
  params: systemNotifyListParams
): Promise<BasicPagingListResult<SystemNotifyListResult>> => get(`/upms/systemNotify/page`, params);
// 系统公告详情
export const systemNotifyDetail = (id: number): Promise<SystemNotifyDetailResult> =>
  get(`/upms/systemNotify/detail`, { id });

/**
 * 待办统计信息
 */
export const getTodoStatistics = (): Promise<GetTodoStatisticsResult> =>
  get(Api.GET_TODO_STATISTICS);

export const getInventoryIndicator = (): Promise<IInventoryIndicator> =>
  get(Api.GET_INVENTORY_INDICATOR);

export const getFootprintIndicator = (): Promise<IFootprintIndicator> =>
  get(Api.GET_FOOTPRINT_INDICATOR);

export const getContactInfo = (): Promise<IContactInfo> => get(Api.GET_CONTACT_INFO);
